﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Management
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }
        public static Dictionary<string, string> users = new Dictionary<string, string>();
        private void button1_Click(object sender, EventArgs e)
        {
            var uid = textBox1.Text;
            var pwd = textBox2.Text;

            var user = users.Where(x => x.Key == uid && x.Value == pwd)
                .Select(x => new { key = x.Key, value = x.Value }).FirstOrDefault();

            if(user!=null)
            {
                MessageBox.Show("登陆成功呦！","提示");
                Database database = new Database();
                database.Show();
            }
            else
            {
                MessageBox.Show("登录失败咯！", "提示");
            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            users.Add("sa","123");
            users.Add("admin", "1234");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Post post = new Post();
            post.Show();
        }
    }
}
